package cronjob

import (
	"kms-backend/controllers"
	"kms-backend/utils/logs"

	"github.com/dotbalo/kubeutils/kubeutils"
	"github.com/gin-gonic/gin"
	batchv1 "k8s.io/api/batch/v1"
)

func Update(r *gin.Context) {
	logs.Debug(nil, "更新cronjob")
	var cronjob batchv1.CronJob
	info := controllers.Info{}
	info.Item = &cronjob
	kubeconfig := controllers.NewInfo(r, &info, "更新cronjob成功")
	// 使用kubeutils接口创建cronjob
	var kubeUtilser kubeutils.KubeUtilser
	instance := kubeutils.NewCronJob(kubeconfig, &cronjob)
	// 把实例赋值给kubeUtilser
	kubeUtilser = instance
	// 使用kubeUtilser创建
	info.Update(r, kubeUtilser)

}
